﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace dotnet_ef_admin.Src.Models;

[Table("role")]
public class Role {
    [Key] public int Id { get; set; }

    [Required] public required string Name { get; set; }

    public string? Code { get; set; }

    public int? Sort { get; set; } = 0;

    public int? Status { get; set; } = 1;

    [Column("data_scope")] public int DataScope { get; set; }

    public int? Deleted { get; set; } = 0;

    [Column("create_time")] public DateTime? CreateTime { get; set; } = DateTime.Now;

    [Column("update_time")] public DateTime? UpdateTime { get; set; }

    public ICollection<RolesOnMenus> Menus { get; set; } = [];

    public ICollection<UsersOnRoles> Users { get; set; } = [];
}